/*****************************************************************************************
Arise Engine		ToolsPage1.cpp

					E-mail:		arise_engine@mail.ru

created:			28.03.2007
last changes:		15.05.2007
*****************************************************************************************/
#include "stdafx.h"
#include ".\toolspage1.h"

#pragma warning( disable : 4800)

IMPLEMENT_DYNAMIC(ToolsPage1, CDialog)
ToolsPage1::ToolsPage1(CWnd* pParent /*=NULL*/)
	: CDialog(ToolsPage1::IDD, pParent)
{
	
}

ToolsPage1::~ToolsPage1()
{

}


BEGIN_MESSAGE_MAP(ToolsPage1, CDialog)
	ON_BN_CLICKED(IDC_CHECK_WIREFRAME,		OnBnClickedCheckWireframe)
	ON_BN_CLICKED(IDC_CHECK_RENDER_PORTALS,	OnBnClickedCheckRenderPortals)
	ON_BN_CLICKED(IDC_CHECK_DEBUG_INFO,		OnBnClickedCheckDebugInfo)
	ON_BN_CLICKED(IDC_CHECK_SECTORS_ONLY,	OnBnClickedCheckSectorsOnly)
	ON_BN_CLICKED(IDC_SHOW_PHYSIC,			OnBnClickedShowPhysic)
	ON_BN_CLICKED(IDC_PHYSIC_PAUSE,			OnBnClickedPhysicPause)
	ON_BN_CLICKED(IDC_APPLY_FREE_CAMERA,	OnBnClickedApplyFreeCamera)
END_MESSAGE_MAP()


HWND g_hwnd_toolspage_1;

void ToolsPage1::DoDataExchange(CDataExchange* pDX)
{
	g_hwnd_toolspage_1 = GetSafeHwnd();

	CDialog::DoDataExchange(pDX);

    CheckDlgButton( IDC_CHECK_WIREFRAME,		g_editor.m_scene.IsRenderWireframe());
    CheckDlgButton( IDC_CHECK_RENDER_PORTALS,	g_editor.m_scene.IsRenderPortals());
    CheckDlgButton( IDC_CHECK_DEBUG_INFO,		g_editor.m_scene.IsRenderDebugInfo());
    CheckDlgButton( IDC_CHECK_SECTORS_ONLY,		g_editor.m_scene.IsRenderSectorsOnly());
    CheckDlgButton( IDC_SHOW_PHYSIC,			g_editor.m_scene.IsRenderPhysic());
    CheckDlgButton( IDC_PHYSIC_PAUSE,			g_editor.m_scene.IsPhysicPaused());
    CheckDlgButton( IDC_APPLY_FREE_CAMERA,		g_editor.m_scene.IsFreeCamera());

}


void ToolsPage1::OnBnClickedCheckWireframe()
{
	g_editor.m_scene.SetRenderWireframe(IsDlgButtonChecked(IDC_CHECK_WIREFRAME));
}

void ToolsPage1::OnBnClickedCheckRenderPortals()
{
	g_editor.m_scene.SetRenderPortals(IsDlgButtonChecked(IDC_CHECK_RENDER_PORTALS));
}

void ToolsPage1::OnBnClickedCheckDebugInfo()
{
	g_editor.m_scene.SetRenderDebugInfo(IsDlgButtonChecked(IDC_CHECK_DEBUG_INFO));
}

void ToolsPage1::OnBnClickedCheckSectorsOnly()
{
	g_editor.m_scene.SetRenderSectorsOnly(IsDlgButtonChecked(IDC_CHECK_SECTORS_ONLY));
}


void ToolsPage1::OnBnClickedShowPhysic()
{
	g_editor.m_scene.SetRenderPhysic(IsDlgButtonChecked(IDC_SHOW_PHYSIC));
}

void ToolsPage1::OnBnClickedPhysicPause()
{
	g_editor.m_scene.SetPhysicPause(IsDlgButtonChecked(IDC_PHYSIC_PAUSE));
}

void ToolsPage1::OnBnClickedApplyFreeCamera()
{
	g_editor.m_scene.SetFreeCamera(IsDlgButtonChecked(IDC_APPLY_FREE_CAMERA));
}
